package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.mapper.entity.QuestionBank;
import com.example.demo.mapper.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface QuestionBankManageMapper extends BaseMapper<QuestionBank> {
    @Delete("<script>" +
            "DELETE FROM question_bank" +
            " WHERE bank_id IN" +
            " <foreach collection='list' index='index' open='(' separator=',' close=')' item='requestList' >" +
            "   #{requestList.bankId}" +
            " </foreach>" +
            "</script>")
    int batchDeleteQuestionBank(List<QuestionBank> requestList);
    @Select("SELECT COUNT(*) FROM task WHERE bank_id = #{bankId};")
    int countBankFormTask(int bankId);
}
